.\" $Id: PAPI_stop_counters.3,v 1.10 2004/10/04 02:16:27 jthomas Exp $
.TH PAPI_stop_counters 3 "September, 2004" "PAPI Programmer's Reference" "PAPI"

.SH NAME
PAPI_stop_counters \- PAPI High Level: stop counting hardware events and reset values to zero

.SH SYNOPSIS
.B C Interface
.nf
.B #include <papi.h>
.BI "int\ PAPI_stop_counters(long_long *" values ", int " array_len ");"
.fi
.B Fortran Interface
.nf
.BI PAPIF_stop_counters(C_LONG_LONG(*)\  values,\  C_INT\  array_len,\  C_INT\  check )
.B #include "fpapi.h"
.fi

.SH DESCRIPTION
.B PAPI_stop_counters(\|)
.LP
This function stops the counters and copies the counts
into the values array. The counters must have been
started by a previous call to PAPI_start_counters().
After this function is called, the values are reset to
zero.
.SH ARGUMENTS
.I *values
-- an array where to put the counter values
.LP
.I array_len 
-- the number of items in the *values array
.LP

.SH RETURN VALUES
On success, this function returns
.B "PAPI_OK."
 On error, a non-zero error code is returned.

.SH ERRORS
.TP
.B "PAPI_EINVAL"
One or more of the arguments is invalid.
.TP
.B "PAPI_ENOTRUN"
The eventset is not started yet.
.TP
.B "PAPI_ENOEVST"
The eventset has not been added yet.

.SH EXAMPLES
.nf
.if t .ft CW
  int Events[2] = { PAPI_TOT_CYC, PAPI_TOT_INS };
  long_long values[2];
  /* Start counting events */
  if (PAPI_start_counters(Events, 2) != PAPI_OK)
    handle_error(1);
  your_slow_code();
  /* Stop counting events */
  if (PAPI_stop_counters(values, 2) != PAPI_OK)
    handle_error(1);
.if t .ft P
.fi

.SH BUGS
This function has no known bugs.

.SH SEE ALSO
.BR PAPI_start_counters "(3)," PAPI_set_opt "(3),"
.BR PAPI_read_counters "(3)," PAPI"(3)," PAPIF "(3)"
